package com.ckzp.jfinal.weixin.task;

import com.ckzp.core.ConfigUtil;
import com.ckzp.jfinal.plugins.cron4j.MyTask;
import com.ckzp.jfinal.system.util.SysTaskUtil;
import com.ckzp.jfinal.weixin.util.WxMessageUtil;
import com.jfinal.core.Controller;
import com.jfinal.plugin.cron4j.ITask;
import org.apache.log4j.Logger;


/**
 * Created by 51594 on 2022/5/5.
 */
public class AutoSendWxMessageTask extends Controller implements ITask, MyTask {


    private static final Logger log = Logger.getLogger(AutoSendWxMessageTask.class);

    private String name = "";
    private boolean logs = false;


    public void setLog(boolean log) {
        logs = log;
    }

    public void setName(String names) {
        name = names;
    }

    @Override
    public void run() {
        if (ConfigUtil.isLinux()) {
            //发送待发送的微信消息
            SysTaskUtil.n().updateLastAction(name);
            WxMessageUtil.sendWxMessage();
        }
    }

    @Override
    public void stop() {
        System.out.println("===========发送微信消息任务结束了===============");
    }

}
